package com.handinfo.android.game.item;

import com.handinfo.android.DWGameManager;
import com.handinfo.android.core.net.GameProtocol;
import com.handinfo.android.game.Cell;
import com.handinfo.android.game.Role;
import com.handinfo.android.utils.Tools;


public class ItemConsume extends Item
{
	public int m_cd_type;// 类型(0,1,2,)
	public long m_time_cd;// cd时间
	
	public boolean doShortcutAction()
	{
		Tools.debugPrintln("ItemConsume 进了使用");
		Cell[] cells = DWGameManager.getInstance().m_role.getCells(Cell.TYPE_COLUMN_ROLEBAG);
		if (cells != null && cells.length > 0) {
			for (Cell object : cells) {
				Item item = object.m_item;
				if (item != null && item.m_key.equals(m_key)) {
					if (item.m_num > 0) {
						DWGameManager.getInstance().getSendMessage().sendOperaterCellMenuCommand(GameProtocol.操作菜单_使用,
								(byte) object.m_column_type, object.m_index);
					}
					else {
						//TODO 添加显示道具数量不足
						Tools.debugPrintln("快捷键使用消耗道具数量不足！");
					}
					break;
				}
			}
		}
		return true;
	}

	public boolean doShortcutAction(Role role)
	{
		return true;
	}
}
